import string
from   openai import OpenAI

class Evaluator(object):
    def __init__(self, choices, model_name, base_url, api_key, k=-1, logger=None):
        self.choices    = choices             #! 答案选项 ["A", "B", "C", "D"]
        self.modle_name = model_name
        self.k          = k
        self.logger     = logger

        # 特殊符号: ['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', 
        #          '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', 
        #          '_', '`', '{', '|', '}', '~']
        self.puncs      = list(string.punctuation)
        self.client     = OpenAI(api_key=api_key, base_url=base_url)
        

    def format(self, line, with_answer=True, cot=False, prompt=""):
        raise NotImplementedError("请在子类中实现该方法...")

    def gen_few_shot(self, subject, dev_df, cot=False):
        raise NotImplementedError("请在子类中实现该方法...")

    def eval(self, subject, test_df, dev_df=None, few_sot=False, cot=False, save_dir=None):
        raise NotImplementedError("请在子类中实现该方法...")

    def extract_cot_answer(self, line, gen_answer):
        raise NotImplementedError("请在子类中实现该方法...")